package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * ci_college_info实体类
 *
 * @author gaodx
 *
 */
@Data
public class CiCollegeInfo implements Serializable{
	/**id*/
    @ApiModelProperty(value = "id")
	private Integer id; 
	/**学院名称*/
    @ApiModelProperty(value = "学院名称")
	private String collegeName; 
	/**学院封面*/
	@NotNull(message = "学院封面不可为空")
    @ApiModelProperty(value = "学院封面")
	private String collegeImage;
	/**学院描述*/
	@NotNull(message = "学院描述不可为空")
    @ApiModelProperty(value = "学院描述")
	private String collegeDesc; 
	/**01-可用 02-不可用*/
    @ApiModelProperty(value = "01-可用 02-不可用")
	private String status; 
	/**学院有效期开始时间*/
    @ApiModelProperty(value = "学院有效期开始时间")
	private Date startTime; 
	/**学院有效期结束时间*/
    @ApiModelProperty(value = "学院有效期结束时间")
	private Date endTime; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**修改时间*/
    @ApiModelProperty(value = "修改时间")
	private Date updateTime;

	/**
	 * 实例化
	 */
	public CiCollegeInfo() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public CiCollegeInfo(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("collegeName") instanceof String) {
			this.setCollegeName((String) obj.get("collegeName"));
		}
		if (obj.get("collegeImage") instanceof String) {
			this.setCollegeImage((String) obj.get("collegeImage"));
		}
		if (obj.get("collegeDesc") instanceof String) {
			this.setCollegeDesc((String) obj.get("collegeDesc"));
		}
		if (obj.get("status") instanceof String) {
			this.setStatus((String) obj.get("status"));
		}
		this.setStartTime((Date) obj.get("startTime"));
		this.setEndTime((Date) obj.get("endTime"));
		this.setCreateTime((Date) obj.get("createTime"));
		this.setUpdateTime((Date) obj.get("updateTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getCollegeName() != null) {
			result.put("collegeName",this.getCollegeName());
		}
		if (this.getCollegeImage() != null) {
			result.put("collegeImage",this.getCollegeImage());
		}
		if (this.getCollegeDesc() != null) {
			result.put("collegeDesc",this.getCollegeDesc());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getStartTime() != null) {
			result.put("startTime",this.getStartTime());
		}
		if (this.getEndTime() != null) {
			result.put("endTime",this.getEndTime());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "CiCollegeInfo [id=" + id + " , collegeName=" + collegeName + " , collegeImage=" + collegeImage + " , collegeDesc=" + collegeDesc + " , status=" + status + " , startTime=" + startTime + " , endTime=" + endTime + " , createTime=" + createTime + " , updateTime=" + updateTime + "  ]";
	
	}
	
	
}
